package com.yunda.AJDeviceService.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunda.AJDeviceService.dao.DetailDataDao;
import com.yunda.AJDeviceService.data.IntelligentCheckDetailData;
import com.yunda.AJDeviceService.service.DetailDataService;
import com.yunda.AJDeviceService.utils.DateUtils;

/**
 * AJDeviceService
 * @description 安检机明细数据
 * @author ljc
 * @create 2023年2月10日 下午3:43:46
 */
@Service
public class DetailDataServiceImpl extends ServiceImpl<DetailDataDao, IntelligentCheckDetailData> implements DetailDataService{

	String osName = System.getProperty("os.name").toLowerCase();

	
	@Override
	public boolean saveDetailData(IntelligentCheckDetailData detail) {
		String mkdirStr="";
        if(osName.contains("windows")){
        	mkdirStr="F:\\u02\\data\\inteCheckImg\\"+DateUtils.dateTime(detail.getScanTime())+"\\"
        			+detail.getFbCode().toString()+"\\"+detail.getDeviceCode()+"\\"+detail.getImageName();
        }else {
        	mkdirStr="//u02/data/inteCheckImg/"+ DateUtils.dateTime(detail.getScanTime())
        			+"/"+ detail.getFbCode().toString() +"/"+ detail.getDeviceCode()+"/"+detail.getImageName();
        }
        detail.setImageName(mkdirStr);
        return this.save(detail);
	}
	
	@Override	
	public List<IntelligentCheckDetailData> selectDetailData(IntelligentCheckDetailData param) {
		QueryWrapper<IntelligentCheckDetailData> queryWrapper=new QueryWrapper<>();
		queryWrapper.eq("fb_code", param.getFbCode());
		List<IntelligentCheckDetailData> timeList= this.list(queryWrapper);
		return timeList;
	}
	
	
}
